package cn.iocoder.yudao.module.picturebook.dal.mysql.classhomework;

import java.time.LocalDate;
import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.picturebook.dal.dataobject.classhomework.ClassHomeworkDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.picturebook.controller.admin.classhomework.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 班级作业信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ClassHomeworkMapper extends BaseMapperX<ClassHomeworkDO> {

    default PageResult<ClassHomeworkDO> selectPage(ClassHomeworkPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ClassHomeworkDO>()
                .eqIfPresent(ClassHomeworkDO::getClassId, reqVO.getClassId())
                .likeIfPresent(ClassHomeworkDO::getHomeworkName, reqVO.getHomeworkName())
                .eqIfPresent(ClassHomeworkDO::getBookId, reqVO.getBookId())
                .eqIfPresent(ClassHomeworkDO::getDeadline, reqVO.getDeadline())
                .eqIfPresent(ClassHomeworkDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ClassHomeworkDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ClassHomeworkDO::getId));
    }

    List<Long> getHomeworkByClassId(@Param("classId") Long id,@Param("now") LocalDate now);
}